Metadata is data that describes other data. The "meta" prefix often means "an underlying definition or description".
Metadata Example: The source of this webpage (as of the original writing) has 52,129 characters. The "Content-Type" meta tag describes the content of this page as 'text/html;charset=utf-8".
In Dynamics CRM, a single field, such as the Name field for an Account record, has 36 metadata attributes including IsAuditEnabled, IsPrimaryName, LogicalName, MaxLength, etc.
Dynamics CRM 2015 "Vanilla" Metadata (in Excel file)
This Excel file contains metadata details for a "vanilla" (non-customized) CRM 2015 Online organization. This can provide a good reference to compare what's changed in a customized CRM organization.
http://msdn.microsoft.com/en-us/library/hh547411.aspx
You can use the Entity Metadata Browser to view entities and their properties in Microsoft Dynamics CRM. The Entity Metadata Browser is a managed solution available in the downloadable files available in the Microsoft Dynamics CRM SDK at SDK\Tools\MetadataBrowser\MetadataBrowser_2_0_0_5_managed.zip.
Dynamics XRM Tools
http://dynamicsxrmtools.codeplex.com/
The toolset consists of a Silverlight application framework that provides a central location for accessing the tools and you simply import the managed solution into CRM to begin working with it.
Altriva Metadata Export Tool
Altriva built an in-house tool that exports CRM metadata and stores the metadata in Microsoft Excel for easy filtering and repurposing. The tool currently exports the following CRM metadata:
Entities, Attributes, Option Sets, 1:N and N:N relationships, Web Resources, Workflows, Forms (structure, events, jscript), Plug-ins (assemblies, steps), Views/queries, Roles, Field Permissions, Connection Roles, System Users, Business Units, Record Counts
Seeing differences between CRM environments is as easy as comparing the exported metadata as CSV files (using a tool such as Beyond Compare or WinDiff) or importing the data into Excel and viewing the differences using Excel's built-in "Inquire" workbook comparison feature.
Dynamics CRM is "Metadata Driven"
You can see in this Dynamics CRM architecture diagram that metadata is a foundational part of the platform.
Metadata Operations with the Dynamics CRM SDK
The Microsoft Dynamics CRM SDK provides several classes and sample applications to assist with metadata CRUD operations.
Most of what you can do in the Dynamics CRM user-interface (in a Web browser, logged-in as an administrator or customizer), you can also do with the metadata libraries and tools in the Dynamics CRM SDK. For example, you can use SDK classes to create, update and delete entities, fields (attributes), picklist options, entity relationships, etc.
Uses for Extracted Dynamics CRM Metadata
There are numerous reasons why it's necessary and/or useful to retrieve and use metadata from Dynamics CRM. The Dynamics CRM SDK lists reasons such as building a UI for client applications and helping to map CRM data to other systems. Below are many more uses for CRM metadata:
Export CRM metadata and check-in to a source control system to keep track of changes over time
Use a code generator, such as T4 in Visual Studio, to generate code based on the entities, fields, etc. within CRM. For example, use T4 to build a C# class with CRM constants for a project or to build classes for various entities in CRM for easier programming ("early-bound" development).
Dynamically generate SQL tables to match CRM entity/field structures to store CRM data in external databases. (This is mostly useful for CRM Online.)
Cache the CRM metadata in an application and use it for data validation for external applications. For example, if an application that's integrated with CRM attempts to set a pickup (OptionSet) value that is incorrect based on CRM metadata then you can proactively block the attempt.
Generate metadata reports to hand off to other groups in a company for review. For example, you might want another department to view the Account entity's fields along with Display Name and Description in a Microsoft Word document for easy consumption.
Use the metadata to generate entity relationship diagrams with Visio. There's a sample console application in the Dynamics CRM SDK that provides an example for this.
Use the exported metadata to spell-check field descriptions and look for fields that are missing a description.
Other Metadata Info
Use SQL Server to Parse CRM Form XML
It's possible to use SQL Server (including SQL Azure) to parse the XML for CRM forms. With the form's XML, you can run a query to, for example, list all JavaScript libraries applied to a form.
DECLARE @DocHandle int
DECLARE @XmlDocument nvarchar(max)
SET @XmlDocument = N'YOUR CRM FORM XML GOES HERE'
EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument
SELECT *
FROM OPENXML (@DocHandle, '/form/formLibraries/Library',1)
WITH (name varchar(100),
libraryUniqueId varchar(50))
EXEC sp_xml_removedocument @DocHandle
Or list all tabs on the form, as in this example.
DECLARE @DocHandle int
DECLARE @XmlDocument nvarchar(max)
SET @XmlDocument = N'YOUR CRM FORM XML GOES HERE'
EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument
SELECT *
FROM OPENXML (@DocHandle, '/form/tabs/tab',1)
WITH (name varchar(100))
EXEC sp_xml_removedocument @DocHandle
Form Control Types (in XML format)
Controls, such as fields, subgrids, IFRAMEs, etc,. on a CRM form have an id and classid. You can see those values if you examine the XML for a form.
The CRM SDK provides the control type and classid (GUID) for each type of form control.
Those control types and their corresponding classid is provided below in XML format. You can use this information to build a list of controls on a CRM form along with the control type.
Using the form control types XML, it's possible to use T-SQL to list all controls on a form along with the type:
DECLARE @DocHandle int
DECLARE @DocHandle2 int
DECLARE @XmlDocument nvarchar(max)
DECLARE @XmlControlTypes nvarchar(max)
SET @XmlControlTypes = N'CONTROL TYPE XML GOES HERE'
SET @XmlDocument = N'FORM XML GOES HERE'
EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument
EXEC sp_xml_preparedocument @DocHandle2 OUTPUT, @XmlControlTypes
SELECT Controls.id AS ControlId, ControlTypes.name AS ControlName
FROM OPENXML (@DocHandle, '/form/tabs/tab/columns/column/sections/section/rows/row/cell/control', 1) WITH (id varchar(100), classid varchar(100)) AS Controls
LEFT JOIN
OPENXML (@DocHandle2, '/FormControlTypes/FormControlType', 1) WITH (name varchar(100), classid varchar(100)) AS ControlTypes
ON REPLACE(REPLACE(Controls.classid,'{',''),'}','') = ControlTypes.classid
ORDER BY 1
EXEC sp_xml_removedocument @DocHandle
EXEC sp_xml_removedocument @DocHandle2
Metadata... in general
Metadata is data that describes other data. The "meta" prefix often means "an underlying definition or description".Metadata Example: The source of this webpage (as of the original writing) has 52,129 characters. The "Content-Type" meta tag describes the content of this page as 'text/html;charset=utf-8".
In Dynamics CRM, a single field, such as the Name field for an Account record, has 36 metadata attributes including IsAuditEnabled, IsPrimaryName, LogicalName, MaxLength, etc.
Dynamics CRM 2015 "Vanilla" Metadata (in Excel file)
This Excel file contains metadata details for a "vanilla" (non-customized) CRM 2015 Online organization. This can provide a good reference to compare what's changed in a customized CRM organization.Browsing and Exporting Metadata
Microsoft’s metadata browser
http://msdn.microsoft.com/en-us/library/hh547411.aspxYou can use the Entity Metadata Browser to view entities and their properties in Microsoft Dynamics CRM. The Entity Metadata Browser is a managed solution available in the downloadable files available in the Microsoft Dynamics CRM SDK at SDK\Tools\MetadataBrowser\MetadataBrowser_2_0_0_5_managed.zip.
Dynamics XRM Tools
http://dynamicsxrmtools.codeplex.com/The toolset consists of a Silverlight application framework that provides a central location for accessing the tools and you simply import the managed solution into CRM to begin working with it.
Altriva Metadata Export Tool
Altriva built an in-house tool that exports CRM metadata and stores the metadata in Microsoft Excel for easy filtering and repurposing. The tool currently exports the following CRM metadata:Entities, Attributes, Option Sets, 1:N and N:N relationships, Web Resources, Workflows, Forms (structure, events, jscript), Plug-ins (assemblies, steps), Views/queries, Roles, Field Permissions, Connection Roles, System Users, Business Units, Record Counts
Seeing differences between CRM environments is as easy as comparing the exported metadata as CSV files (using a tool such as Beyond Compare or WinDiff) or importing the data into Excel and viewing the differences using Excel's built-in "Inquire" workbook comparison feature.
Dynamics CRM is "Metadata Driven"
You can see in this Dynamics CRM architecture diagram that metadata is a foundational part of the platform.Metadata Operations with the Dynamics CRM SDK
The Microsoft Dynamics CRM SDK provides several classes and sample applications to assist with metadata CRUD operations.
Most of what you can do in the Dynamics CRM user-interface (in a Web browser, logged-in as an administrator or customizer), you can also do with the metadata libraries and tools in the Dynamics CRM SDK. For example, you can use SDK classes to create, update and delete entities, fields (attributes), picklist options, entity relationships, etc.
Uses for Extracted Dynamics CRM Metadata
There are numerous reasons why it's necessary and/or useful to retrieve and use metadata from Dynamics CRM. The Dynamics CRM SDK lists reasons such as building a UI for client applications and helping to map CRM data to other systems. Below are many more uses for CRM metadata:Other Metadata Info
Use SQL Server to Parse CRM Form XML
It's possible to use SQL Server (including SQL Azure) to parse the XML for CRM forms. With the form's XML, you can run a query to, for example, list all JavaScript libraries applied to a form.DECLARE @DocHandle int DECLARE @XmlDocument nvarchar(max) SET @XmlDocument = N'YOUR CRM FORM XML GOES HERE' EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument SELECT * FROM OPENXML (@DocHandle, '/form/formLibraries/Library',1) WITH (name varchar(100), libraryUniqueId varchar(50)) EXEC sp_xml_removedocument @DocHandleOr list all tabs on the form, as in this example.DECLARE @DocHandle int DECLARE @XmlDocument nvarchar(max) SET @XmlDocument = N'YOUR CRM FORM XML GOES HERE' EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument SELECT * FROM OPENXML (@DocHandle, '/form/tabs/tab',1) WITH (name varchar(100)) EXEC sp_xml_removedocument @DocHandleForm Control Types (in XML format)
Controls, such as fields, subgrids, IFRAMEs, etc,. on a CRM form have an id and classid. You can see those values if you examine the XML for a form.The CRM SDK provides the control type and classid (GUID) for each type of form control.
Those control types and their corresponding classid is provided below in XML format. You can use this information to build a list of controls on a CRM form along with the control type.
Using the form control types XML, it's possible to use T-SQL to list all controls on a form along with the type:
DECLARE @DocHandle int DECLARE @DocHandle2 int DECLARE @XmlDocument nvarchar(max) DECLARE @XmlControlTypes nvarchar(max) SET @XmlControlTypes = N'CONTROL TYPE XML GOES HERE' SET @XmlDocument = N'FORM XML GOES HERE' EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument EXEC sp_xml_preparedocument @DocHandle2 OUTPUT, @XmlControlTypes SELECT Controls.id AS ControlId, ControlTypes.name AS ControlName FROM OPENXML (@DocHandle, '/form/tabs/tab/columns/column/sections/section/rows/row/cell/control', 1) WITH (id varchar(100), classid varchar(100)) AS Controls LEFT JOIN OPENXML (@DocHandle2, '/FormControlTypes/FormControlType', 1) WITH (name varchar(100), classid varchar(100)) AS ControlTypes ON REPLACE(REPLACE(Controls.classid,'{',''),'}','') = ControlTypes.classid ORDER BY 1 EXEC sp_xml_removedocument @DocHandle EXEC sp_xml_removedocument @DocHandle2.
Links
Retrieve and detect changes to metadata